<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      ul {
        background-color: aqua;
        display: none;
        position: absolute;
        list-style: none;
      }
    </style>
  </head>
  <body>
    <ul>
      <li>重新加载</li>
      <li>点击生成二维码</li>
      <li>11111</li>
      <li>11111</li>
      <li>11111</li>
      <li>重新加载</li>
      <li>点击生成二维码</li>
    </ul>
    <script>
      document.documentElement.oncontextmenu = function (e) {
        e.preventDefault();
        var ulEle = document.querySelector("ul");
        ulEle.style.display = "block";
        ulEle.style.left = e.clientX + "px";
        ulEle.style.top = e.clientY + "px";
        ulEle.onmouseover = function (e) {
          var e = e || window.e;
          var target = e.target || e.srcElement;
          if ((target.nodeName = "LI")) {
            e.target.style.background = "pink";
          }
        };
        ulEle.onmouseout = function (e) {
          var e = e || window.e;
          var target = e.target || e.srcElement;
          if ((target.nodeName = "LI")) {
            e.target.style.background = "aqua";
          }
        };
      };
    </script>
  </body>
</html>
